home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2005 August / DPPCPRO0805.ISO / Assets / Interface / Main.dxr / Movie Scripts_1_Filesystem behaviours.ls < prev    next >
Encoding:
Text File  |  2005-05-20  |  3.8 KB  |  124 lines

  1. on getVolume
  2.   splitPosn = offset("\", the moviePath)
  3.   volumeName = (the moviePath).char[1..splitPosn]
  4.   return volumeName
  5. end
  6.  
  7. on fileExists path_file
  8.   fileTest = new(xtra("fileio"))
  9.   openfile(fileTest, path_file, 1)
  10.   fileResult = status(fileTest)
  11.   closeFile(fileTest)
  12.   if fileResult = 0 then
  13.     return 1
  14.   else
  15.     return 0
  16.   end if
  17. end
  18.  
  19. on launch targetPath
  20.   if targetPath.char[1..4] = "http" then
  21.     gotoNetPage(targetPath, "_new")
  22.   else
  23.     if targetPath.char[1..8] = "local://" then
  24.       localHTML = getVolume() & targetPath.char[9..targetPath.length]
  25.       gotoNetPage(unescapePath(localHTML), "_new")
  26.     else
  27.       if targetPath.char[1..6] = "alert:" then
  28.         alert(targetPath.char[7..targetPath.length])
  29.       else
  30.         if targetPath.char[1..6] = "mailto" then
  31.           fileXtraObj = xtra("FileXtra4").new()
  32.           myDocsPath = fileXtraObj.fx_FolderGetSpecialPath("CSIDL_WINDOWS")
  33.           myDocsPath = myDocsPath.char[1..3]
  34.           shortcutFile = myDocsPath & "PCProjects.url"
  35.           fileIOObj = new xtra("fileio")
  36.           if fileExists(shortcutFile) then
  37.             fileIOObj.openfile(shortcutFile, 2)
  38.             delete fileIOObj
  39.             fileIOObj.closeFile()
  40.           end if
  41.           fileIOObj = new xtra("fileio")
  42.           fileIOObj.createFile(shortcutFile)
  43.           fileIOObj.openfile(shortcutFile, 2)
  44.           fileIOObj.writeString("[InternetShortcut]")
  45.           fileIOObj.writeReturn(#windows)
  46.           fileIOObj.writeString("URL=" & targetPath)
  47.           fileXtraObj.fx_FileOpenDocument(shortcutFile)
  48.           fileIOObj.closeFile()
  49.           fileXtraObj = 0
  50.           fileIOObj = VOID
  51.         else
  52.           launchByExtension(targetPath)
  53.         end if
  54.       end if
  55.     end if
  56.   end if
  57. end
  58.  
  59. on launchByExtension targetPath
  60.   pathLen = targetPath.length
  61.   startPosn = offset(".", targetPath.char[pathLen - 4..pathLen])
  62.   if targetPath.char[2..3] = ":\" then
  63.     fullPath = targetPath
  64.   else
  65.     fullPath = getVolume() & targetPath
  66.   end if
  67.   fileXtra = xtra("FileXtra4").new()
  68.   case targetPath.char[pathLen - 4 + startPosn..pathLen] of
  69.     "exe":
  70.       runResult = fileXtra.fx_FileRunApp(fullPath)
  71.     "msi":
  72.       msiHandler = fileXtra.fx_FileGetAppPath(".msi")
  73.       if msiHandler contains "msiexec" then
  74.         launchStr = QUOTE & targetPath & QUOTE
  75.         open("/I" && QUOTE & targetPath & QUOTE, "msiexec.exe")
  76.       else
  77.         alert("Windows Installer 2.0 has could not be found. It is required to install this software. Please check the system requirements box for a link to the Microsoft website")
  78.       end if
  79.       runResult = 1
  80.     "hta":
  81.       htaHandler = fileXtra.fx_FileGetAppPath(".hta")
  82.       if htaHandler contains "mshta" then
  83.         open(QUOTE & targetPath & QUOTE, "mshta.exe")
  84.       else
  85.         alert("Microsoft HTML Application host could not be found. Please contact technical support for assistance and ask them to report error code Launch_HTA to the developer")
  86.       end if
  87.     otherwise:
  88.       if fileXtra.fx_FolderExists(fullPath) then
  89.         open(unescapePath(fullPath), "explorer")
  90.         runResult = 1
  91.       else
  92.         if fileXtra.fx_FileExists(fullPath) then
  93.           runResult = fileXtra.fx_FileOpenDocument(fullPath)
  94.         end if
  95.       end if
  96.   end case
  97.   fileXtra = 0
  98.   if runResult = 0 then
  99.     alert("Failed to open: " & fullPath)
  100.   end if
  101. end
  102.  
  103. on getBannerType targetPath
  104.   pathLen = targetPath.length
  105.   startPosn = offset(".", targetPath.char[pathLen - 4..pathLen])
  106.   case targetPath.char[pathLen - 4 + startPosn..pathLen] of
  107.     "swf":
  108.       return #flash
  109.     "gif":
  110.       return #animGif
  111.     "jpeg", "jpg":
  112.       return #bitmap
  113.   end case
  114. end
  115.  
  116. on unescapePath targetPath
  117.   escapePosn = offset("\\", targetPath)
  118.   if escapePosn = 0 then
  119.     return targetPath
  120.   else
  121.     return targetPath.char[1..escapePosn] & unescapePath(targetPath.char[escapePosn + 2..targetPath.length])
  122.   end if
  123. end
  124.